<?php
/**
 * Created by PhpStorm.
 * User: guozhen
 * Date: 16/9/26
 * Time: 下午6:34
 */
namespace runs;
include_once('../server/namespace.php');
use \extension\Main;
use \library\MySQL;
use models\Timer\TimersModel;

ini_set('date.timezone','Asia/Shanghai');
class calc_hospital
{
    private $err = 0;
    public function __construct ()
    {
        $this->begin_time = time();
        $this->config = parse_ini_file("../conf/config.ini", true);
        $MySQL = new MySQL();
        $MySQL->initdb();
    }

    public function script_over ()
    {
        $Mtimers = new TimersModel();
        $res = $Mtimers->Timer();
        if($res){
            Main::log_write_pre('程序执行成功',$path='log_statistics');
        }else{
            $this->err +=1;
            Main::log_write_pre('程序执行失败,发起请求~第'.$this->err.'次',$path='log_statistics');

            if($this->err <=3 ){
                $this->script_over();
            }
        }
    }

}

$calc = new calc_hospital();
//脚本内容。。。
$calc->script_over();



